package com.zq.behavior.visitor;

import java.util.LinkedList;
import java.util.List;

public class ObjectStructure {
    private List<Element> list = new LinkedList<>();

    public void register(Element element) {
        list.add(element);
    }

    public void unregister(Element element) {
        list.remove(element);
    }

    public void accept(Visitor visitor) {
        list.forEach(element -> element.accept(visitor));
    }
}
